/*
* Vargs.java
* Copyright (C) 2003
*
* $Id: Vargs.java,v 1.1.1.1 2004/07/07 19:59:56 hzi Exp $
*/
/*
Copyright (C) 1997-2001 Id Software, Inc.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
*/
using System;
namespace Suake2.UI.util
{
	
	/// <summary> Vargs is a helper class to encapsulate printf arguments.
	/// 
	/// </summary>
	/// <author>  cwei
	/// </author>
	public class Vargs
	{
		
		// initial capacity
		internal const int SIZE = 5;
		
		internal System.Collections.ArrayList v;
		
		public Vargs():this(SIZE)
		{
		}
		
		public Vargs(int initialSize)
		{
			if (v != null)
				v.Clear(); // clear previous list for GC
			v = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(initialSize));
		}
		
		public virtual Vargs add(bool value_Renamed)
		{
			v.Add(value_Renamed);
			return this;
		}
		
		public virtual Vargs add(sbyte value_Renamed)
		{
			v.Add((sbyte) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(char value_Renamed)
		{
			v.Add(value_Renamed);
			return this;
		}
		
		public virtual Vargs add(short value_Renamed)
		{
			v.Add((short) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(int value_Renamed)
		{
			v.Add((System.Int32) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(long value_Renamed)
		{
			v.Add((long) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(float value_Renamed)
		{
			v.Add((float) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(double value_Renamed)
		{
			v.Add((double) value_Renamed);
			return this;
		}
		
		public virtual Vargs add(System.String value_Renamed)
		{
			v.Add(value_Renamed);
			return this;
		}
		
		public virtual Vargs add(System.Object value_Renamed)
		{
			v.Add(value_Renamed);
			return this;
		}
		
		public virtual Vargs clear()
		{
			v.Clear();
			return this;
		}
		
		public virtual System.Collections.ArrayList toVector()
		{
			//		Vector tmp = v;
			//		v = null;
			//		return tmp;
			return (System.Collections.ArrayList) v.Clone();
		}
		
		public virtual System.Object[] toArray()
		{
			return v.ToArray();
		}
		
		public virtual int size()
		{
			return v.Count;
		}
	}
}